<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增客户信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-info-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">合同号：</label>
                <div class="col-sm-8">
                    <input name="contractNo" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">社区名：</label>
                <div class="col-sm-8">
                    <input name="communityName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">客户姓名：</label>
                <div class="col-sm-8">
                    <input name="clientName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">分属区域：</label>
                <div class="col-sm-8">
                    <select id="clientCity" name="clientCity" class="form-control"></select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/info"
        $("#form-info-add").validate({
            focusCleanup: true
        });
        var prefixs = ctx + "system/name"
        selectCityName()
        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-info-add').serialize());
            }
        }
        function selectCityName() {
            $.ajax({
                url: prefixs + "/selectCityName",
                type: "get",
                dataType: "json",
                data: {},
                success: function (data) {
                    if (data.length > 0) {
                        for (i in data) {
                            $("#clientCity").append("<option>" + data[i].cityName + "</option>")
                        }
                    } else {
                        $("#clientCity").append("<option>暂无数据</option>")
                    }
                },
            })
        }
    </script>
</body>
</html>